<template>
    <div id='viewActivity'>
        <img :src="imgurl" style="width: 100%;" />
        <p>发布者： {{sponsor}}</p>
        <p>
            介绍：<br/>
            {{eventDesc}}
        </p>
        <div class="btns">
            <el-button @click="godayList" type='primary'>活动日程</el-button>
            <el-button @click="editActivity" type='primary'>修改活动</el-button>
            <el-button :disabled='isdisabled' @click="delActivity" type='primary'>冻结日程</el-button>
            <el-button @click="goSignList" type='primary'>报名人&nbsp;&nbsp;&nbsp;&nbsp;</el-button>
            <el-button @click="gocommentList" type='primary'>活动评论</el-button>
            <el-button @click="goback" type='primary'>返回</el-button>
        </div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            sponsor: '',
            eventDesc: '',
            imgurl: '',
            isdisabled: this.$route.query.state == 1 ? true : false
        }
    },
    mounted() {
        this.getActivityDetail()
    },
    methods: {
        editActivity() {
            this.$router.push({path: 'addActivity', query:{id: this.$route.query.id, mode: 'edit'}})
        },
        godayList() {
            this.$router.push({path: 'activityDayList', query:{eventId: this.$route.query.id}})
        },
        gocommentList() {
             this.$router.push({path: 'activityComment', query: {eventId: this.$route.query.id}})
        },
        goSignList() {
            this.$router.push({path: 'signpeople', query: {id: this.$route.query.id}})
        },
        goback() {
            this.$router.go(-1)
        },
        getActivityDetail() {
            let param = {
                id: this.$route.query.id
            }
            this.$api.apiActivityDetail(param, res => {
                this.sponsor = res.data.sponsor
                this.eventDesc = res.data.eventDesc
                this.imgurl = res.data.bannerPath
            })
        },
        delActivity() {
            // 冻结日程
            let param = {
                id: Number(this.$route.query.id)
            }
            this.$api.apiDelActivity(param, res => {
                this.$message({
                    type: 'success',
                    message: '冻结成功'
                })

            })
        }
    }
}
</script>
<style lang="scss">
#viewActivity {
    width: 50%;
    margin: 30px auto;
    .btns {
        display: flex;
        flex-wrap: wrap;
        .el-button {
            margin:10px 60px 30px;
        }
    }
}
</style>

